const db = require("../DBHelper");
class Goods {
  async search(req, res) {
    let gid = req.params.gid;
    let sql = "select * from goods where gstatus=1 and gid=? ;";
    let result = await db.exec(sql, [gid]);
    res.json({ msg: "查询成功!", data: result });
  }
  async getgoods(req, res) {
    let sql = "select * from goods";
    let params = [];
    let result = await db.exec(sql, params);
    res.json({ msg: "查询成功!", data: result });
  }
  async getBigimg(req, res) {
    let gid = req.params.gid;
    let sql = "select * from img1 where gid=? ;";
    let result = await db.exec(sql, [gid]);
    res.json({ msg: "查询成功!", data: result });
  }
  async getSmallimg(req, res) {
    let gid = req.params.gid;
    let sql = "select * from img2 where gid=? ;";
    let result = await db.exec(sql, [gid]);
    res.json({ msg: "查询成功!", data: result });
  }
}
module.exports = new Goods();
